package com.zb.validation.demo.controller;

import com.zb.validation.demo.model.Person;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 在控制层的POJO对象上实现Validation
 *
 * @author ZB
 * @version 1.0
 * @since 1.0
 */
@Slf4j
@RestController
@RequestMapping("/demo-2")
public class Demo2Controller {

    @PostMapping("/save-1")
    public HttpStatus save1(@Validated Person person) {
        return HttpStatus.OK;
    }

}
